package com.wuhuiyue.mapper;

import com.wuhuiyue.entity.Center;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author hy-woo
 * @since 2022-06-14
 */
@Mapper
public interface CenterMapper extends BaseMapper<Center> {

    List<Center> getByType(int type);

    @Select("SELECT t.`name`,COUNT(*) num from tb_channel a LEFT JOIN tb_center t ON a.type_id=t.id GROUP BY a.type_id")
    List<Center> getCenter();
}
